<?php
include_once('include/top.php');
        global $db,$teacher_realname,$teacher_id;
        $m=0;
        $n=0;
        $sql_video = "select * from nettteach_videos where belonger = '".$teacher_id."'";//视频数
        $sql_courseware = "select * from nettteach_courseware where writerid = '".$teacher_id."'";//课件数
        $videos_result = $db ->query($sql_video);
        $videos_recordcount = $db -> num_rows($videos_result);
        while($videos_row = mysql_fetch_array($videos_result))
        {
                $m = $m + $videos_row['times'];
        }
        $courseware_result = $db -> query($sql_courseware);
	$courseware_recordcount = $db -> num_rows($courseware_result);
        while($courseware_row = mysql_fetch_array($courseware_result))
        {
                $n = $n + $courseware_row['times'];
        }
?>

<table width="100%" border="0" cellpadding="0" cellspacing="0" class="CContent">
  <tr>
 	<th class="CTitle">欢迎您, <?php echo $teacher_realname?>&nbsp;&nbsp;
                <script type="text/javascript">
                  var today = new Date(); //新建一个Date对象
                  var date = today.getDate();//查询当月日期
                  var day = today.getDay();//查询当前星期几
                  var month = today.getMonth()+1;//查询月份
                  var year = today.getFullYear();//查询年份  
                  var hour=today.getHours();
                  var morning="";
                 if ( hour<12) morning="上午好!";
                 if ( hour>=12) morning="下午好!";
                  var week="";                               
                  if (day==0) week='星期日';
                  if (day==1) week='星期一';
                  if (day==2) week='星期二';
                  if (day==3) week='星期三';
                  if (day==4) week='星期四';
                  if (day==5) week='星期五';
                  if (day==6) week='星期六';
                  document.write(morning);  
                </script>
        </th>
  </tr>
  <tr>
    <td class="CPanel">
        <div id="updateInfo" style="background:ffffe1;border:1px solid #89441f;padding:4px;display:none"></div>

	<table width="100%" border="0" cellpadding="0" cellspacing="0">
	 <tr>
		 <td valign="top" style="padding:5px;width:140px"><img src="images/Icon/ControlPanel.png"/></td>
		 <td valign="top">
		    <div align="left" style="padding:5px;line-height:170%;clear:both;font-size:12px">
		     
		     <b>欢迎使用 新e代-网络教学综合平台系统--教师端！</b><br/>
			上传课件: <?php echo($courseware_recordcount)?> 个    课件浏览量:<?php echo($n)?>  <br><br>
                        上传视频: <?php echo($videos_recordcount)?> 个    视频浏览量:<?php echo($m)?>
                        
		    </div>    
		 </td>
                 
	 </tr>
	</table>

</td></tr></table>
</div>
</body>
</html>